﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoMapper;
using Domain.RealiZation;

namespace WebAPI
{
    public class MapperProfile : Profile
    {
        public MapperProfile()
        {
            CreateMap<Ds.DataBase.Model.MoBan_Main, Domain.Model.Domain_MoBan_Model.Domain_MoBan_Main>()
                .ForMember(dto=>dto.MoBan_Paths,opt=>opt.MapFrom(info=>Mapper.Map<List<Ds.DataBase.Model.MoBan_Path>, List<Domain.Model.Domain_MoBan_Model.Domain_MoBan_Path>>(info.MoBan_Paths.ToList())))
                .ForMember(dto=>dto.ZhiWeis,opt=>opt.Ignore());
            CreateMap<Ds.DataBase.Model.MoBan_Path, Domain.Model.Domain_MoBan_Model.Domain_MoBan_Path>().ForMember(dto=>dto.MoBan_Contents,opt=>opt.MapFrom(info=>info.MoBan_Contents));
            CreateMap<Ds.DataBase.Model.MoBan_Content, Domain.Model.Domain_MoBan_Model.Domain_MoBan_Content>().ForMember(dto=>dto.MoBan_Answers,opt=>opt.MapFrom(info=>info.MoBan_Answers));
            CreateMap<Ds.DataBase.Model.MoBan_Answer, Domain.Model.Domain_MoBan_Model.Domain_MoBan_Answer>();
        }
    }
}